package com.yzyz.utils.json.processor;

import java.text.SimpleDateFormat;

import net.sf.json.JsonConfig;
import net.sf.json.processors.JsonValueProcessor;

public class DateProcessor implements JsonValueProcessor {
	private static String pattern = "yyyy-MM-dd HH:mm:ss";
	private static SimpleDateFormat sf;
	static {
		sf = new SimpleDateFormat(pattern);
	}
	public DateProcessor(String pattern) {
		sf = new SimpleDateFormat(pattern);
	}
	public DateProcessor() {
	}
	@Override
	public Object processArrayValue(Object arg0, JsonConfig arg1) {
		return null;
	}

	@SuppressWarnings("static-access")
	@Override
	public Object processObjectValue(String key, Object value, JsonConfig arg2) {
		return this.sf.format(value);
	}

}
